//
//  CalculateView.m
//  DaoZiJinFu
//
//  Created by woker on 16/6/23.
//  Copyright © 2016年 iwoker. All rights reserved.
//

#import "CalculateView.h"

@implementation CalculateView

+ (instancetype)showView:(UIView *)view {
    CalculateView *cal = [[[NSBundle mainBundle] loadNibNamed:@"CalculateView" owner:nil options:nil] lastObject];
    [view addSubview:cal];
    
//    [cal mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.equalTo(view.mas_top);
//        make.leading.equalTo(view.mas_leading);
//        make.bottom.equalTo(view.mas_bottom);
//        make.trailing.equalTo(view.mas_trailing);
//    }];
    cal.frame = view.frame;
    
    [cal readjustView];
    
    return cal;
}

- (IBAction)closeView:(id)sender {
    [self removeFromSuperview];
}

- (IBAction)moneyChanged:(id)sender {
}

- (IBAction)dayChanged:(id)sender {
}

- (void)readjustView {
    self.leftEdit.layer.borderWidth = 1;
    self.leftEdit.layer.borderColor = RGB(220, 220, 220).CGColor;
    self.leftEdit.layer.masksToBounds = YES;
    self.leftEdit.layer.cornerRadius = 5;
    
    self.rightEdit.layer.borderWidth = 1;
    self.rightEdit.layer.borderColor = RGB(220, 220, 220).CGColor;
    self.rightEdit.layer.masksToBounds = YES;
    self.rightEdit.layer.cornerRadius = 5;
    
    self.alert.layer.masksToBounds = YES;
    self.alert.layer.cornerRadius = 10;
    [_leftEdit becomeFirstResponder];
    
    [_backView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapBackView)]];
}

- (void)tapBackView {
    [self removeFromSuperview];
}

- (void)awakeFromNib {
    [super awakeFromNib];
}

@end
